import { createStore } from 'vuex'
// 这个插件可以做本地存储
import createPersistedstate from 'vuex-persistedstate'

// 3个模块
import cart from './modules/cart'
import category from './modules/category'
import user from './modules/user'
export default createStore({
  state: {
  },
  mutations: {
  },
  actions: {
  },
  modules: {
    cart,
    category,
    user
  },
  plugins: [
    // 默认存储在localstorage上
    createPersistedstate({
      // 本地存储名字
      key: 'shop-pc-store',
      // 缓存的模块名称
      paths: ['user', 'cart']
    })
  ]
})
